#include <iostream>
#include <algorithm>
using namespace std;
const int N = 2e5 + 10;
int a[N];

void solve()
{
    int n; cin >> n;
    for(int i = 1;i <= n;i ++) cin >> a[i];
    sort(a + 1 , a + 1 + n);
    int ret = a[1];
    for(int i = 2;i <= n;i ++)
    {
        ret += (a[i] - 1);
    }
    cout << ret << endl;
}
int main()
{
    int t; cin >> t;
    while(t--)
    {
        solve();
    }
    return 0;
}